import axios from 'axios';
import iView from 'iview';

const ajax = axios.create({
  baseURL: `/fhir-api/`,
  timeout: 10000
});

// http response 拦截器
axios.interceptors.response.use(
  response => {
    return response;
  },
  error => {
    if (error.response) {
      switch (error.response.status) {
        default:
          iView.Notice.error({title: '请求错误', desc: error.response.data})
      }
    }
    return Promise.reject(error.response.data)
  });
export default ajax;
